/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package stuff.ext;

/**
 *
 * @author Николай
 */

import org.springframework.orm.hibernate3.LocalSessionFactoryBean;
import org.springframework.beans.BeanUtils;
import org.hibernate.HibernateException;

import stuff.Account;
import stuff.Country;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.cfg.Configuration;


/**
 * Created by IntelliJ IDEA.
 * User: lamer
 * Date: 16.11.2008
 * Time: 14:44:46
 * To change this template use File | Settings | File Templates.
 */

public class AnnotatedLocalSessionFactoryBean extends LocalSessionFactoryBean {

    @Override
    protected Configuration newConfiguration()
        throws HibernateException
    {
        AnnotationConfiguration ac = (AnnotationConfiguration) BeanUtils.instantiateClass(org.hibernate.cfg.AnnotationConfiguration.class);
        ac.addAnnotatedClass(Account.class);
        ac.addAnnotatedClass(Country.class);
        return ac;
    }
}

